<?php
define('BASE_PATH', realpath(dirname(__FILE__) . '/../'));

// Define path to application directory
define('APPLICATION_PATH', BASE_PATH . '/application');
 
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
 
$include_paths = explode(PATH_SEPARATOR, get_include_path());
//filter out the /usr/lib/php as it isn't allowed on this host
$include_paths = array_diff($include_paths, array("/usr/lib/php"));

$include_paths[] = BASE_PATH . '/library';
$include_paths[] = BASE_PATH . '/../resources'; //for external resources, e.g. Zend

// Typically, you will also want to add your library/ directory
// to the include_path, particularly if it contains your ZF installed
set_include_path(implode(PATH_SEPARATOR, $include_paths));

/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Config/Json.php';

$config = new Zend_Config_Json(APPLICATION_PATH . '/configs/config.json', APPLICATION_ENV, true);
$db_config = new Zend_Config_Json(APPLICATION_PATH . '/configs/db_config.json', APPLICATION_ENV);
$config->merge($db_config);

// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, $config); 

$application->bootstrap()->run();
